package org.wiztools.commons.feed;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author subhash
 */
public abstract class AbstractFeedExecuter implements FeedExecuter {
    
    protected Options options;

    public void setOptions(Options options) {
        this.options = options;
    }

    @Override
    public Feed getAggregateFeeds(Feed feedMeta, List<URL> urls)
            throws FeedException, IOException{
        List<Feed> feeds = new ArrayList<Feed>();
        for (URL url : urls) {
            Feed f = getFeed(url);
            feeds.add(f);
        }
        List<FeedEntry> entries = FeedUtil.sortFeed(feeds);

        Feed feed = (Feed) feedMeta.clone();
        feed.setEntries(entries);
        return feed;
    }
}
